package com.hcbd.tdwt.ui.xingyu.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;


import com.hcbd.tdwt.R;
//import com.wang.avi.AVLoadingIndicatorView;


/**
 * 等待对话框
 */
public class LoadingDialog extends Dialog {
//    private AVLoadingIndicatorView aiv;

    private Context context;
    private TextView tips;
    private String tipStr;

    public LoadingDialog(Context context) {
        super(context);
        this.context=context;

    }
    public LoadingDialog(Context context, String tip_str) {
        super(context);
        this.context=context;
        this.tipStr=tip_str;

    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_load);
        setCanceledOnTouchOutside(false);
        Window window = getWindow();
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        init();
    }
    public void init(){
//        aiv =findViewById(R.id.aiv);
        tips= findViewById(R.id.tips);
        if(tipStr!=null){
            tips.setText(tipStr);
        }
//        aiv.show();
    }
    public void setTips(String tip){
        tipStr=tip;
    }
    public static  void showDialog(Dialog dialog){
        if(dialog!=null&&!dialog.isShowing()){
            dialog.show();
        }
    }
    public static  void shutDown(Dialog dialog){
        if(dialog!=null&&dialog.isShowing()){
            dialog.dismiss();
        }
    }
    @Override
    public void dismiss(){
        super.dismiss();

    }

}
